import { http, Method } from "@/utils/request.js";

/**
 * 获取商家统计信息
 * @param {*} params
 * @returns
 */
export const homeStatistics = (params) => {
  return http.request({
    url: `/statistics/index`,
    method: Method.GET,
  });
};

/**
 * 进入消息中心首次加载全部数据
 * @param {*} params
 * @returns
 */
export const getAllMessage = (params) => {
  return http.request({
    url: `/message/storeMessage/all`,
    method: Method.GET,
    params,
  });
};

/**
 * 已读消息
 * @param {*} params
 * @returns
 */
export const readMessage = (id) => {
  return http.request({
    url: `/message/storeMessage/${id}/read`,
    method: Method.PUT,
    header: { "content-type": "application/x-www-form-urlencoded" },
  });
};

/**
 * 已读消息放入回收站
 * @param {*} params
 * @returns
 */
export const deleteMessage = (ids, params) => {
  return http.request({
    url: `/message/storeMessage/${ids}/delete`,
    method: Method.DELETE,
    header: { "content-type": "application/x-www-form-urlencoded" },
  });
};

/**
 * 回收站还原消息
 * @param {*} params
 * @returns
 */
export const reductionMessage = (ids, params) => {
  return http.request({
    url: `/message/storeMessage/${ids}/reduction`,
    method: Method.PUT,
    header: { "content-type": "application/x-www-form-urlencoded" },
  });
};

/**
 * 已读消息放入回收站
 * @param {*} params
 * @returns
 */
export const clearMessage = (ids, params) => {
  return http.request({
    url: `/message/storeMessage/${ids}`,
    method: Method.DELETE,
    header: { "content-type": "application/x-www-form-urlencoded" },
  });
};
